Exchange 2007 Scripting error: "Object doesn't support this property or method: 'objMailbox.CreateMailbox'
I use the following script to create mailbox-enabled AD accounts on a Exchange 2003 server: 'Creates AD User accounts then mail-enable from information read from a CSV file. 'Exchange Server InformationMDBName = "Mailbox Store (EXCHANGE1)"StorageGroup = "First Storage Group"Server = "EXCHANGE1"AdminGroup = "First Administrative Group"Organization = "First Organization"DomainDN = "DC=domain2,DC=com" Const ForReading = 1Set objFSO = CreateObject("Scripting.FileSystemObject")Set objTextFile = objFSO.OpenTextFile("C:\Scripts\CreateAccounts.csv", ForReading)Do While objTextFile.AtEndOfStream <> True 'Split delimited fields into positions in a array. arrRecord = split(objTextFile.Readline, ",") 'Skip the header line that has filed called Account Name.If (arrRecord(0) <> "Account Name") Then Set objOU = GetObject("LDAP://OU="&arrRecord(9)&",dc=domain2,dc=com") Set objUser = objOU.Create("User", "cn=" & arrRecord(0))objUser.Put "sAMAccountName", arrRecord(1)objUser.Put "givenName", arrRecord(1)objUser.Put "initials", arrRecord(2)objUser.Put "sn", arrRecord(3)objUser.Put "description", arrRecord(4)objUser.Put "displayName", arrRecord(3)&","& arrRecord(1)objUser.Put "physicalDeliveryOfficeName", arrRecord(5) objUser.Put "telephoneNumber", arrRecord(6)objUser.Put "mail", arrRecord(7)objUser.Put "wWWHomePage", arrRecord(8) objUser.SetInfo objUser.SetPassword "P@ssw0rd" objUser.AccountDisabled = False Set objMailbox = objUser objMailbox.CreateMailbox "LDAP://CN=" & MDBName & _ ",CN=" & StorageGroup & _ ",CN=InformationStore" & _ ",CN=" & Server & _ ",CN=Servers" & _ ",CN=" & AdminGroup & _ ",CN=Administrative Groups" & _ ",CN=" & Organization & _ ",CN=Microsoft Exchange,CN=Services" & _ ",CN=Configuration," & DomainDN objUser.SetInfo Wscript.Echo arrRecord(0) Else End ifi = i + 1Loop objTextFile.Close when I try to run this same script on a test Exchange 2007 server I get a "Object doesn't support this property or method: 'objMailbox.CreateMailbox' Windows Host Script error.I have verified that Exchange Management Tools are installed on the server I am running the script on. Thanks!
November 25th, 2008 7:47am

You need to move to Powershell scripting for Exchange 2007 - this is not only quicker, easier & cleaner but also more reliable and it is based around .net 2.0 so you can parse VB or C++ code directly to the powershell. check out the following article for some insight into this: http://technet.microsoft.com/en-us/exchangelabshelp/cc713521.aspx
Free Windows Admin Tool Kit Click here and download it now
November 25th, 2008 9:27am

Hi, Please check whether the below link can help you: http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3971568&SiteID=17 Thanks Allen
November 27th, 2008 12:11pm

Thanks, but the problem I am having is a VBScript problem and not with PowerShell. -j
Free Windows Admin Tool Kit Click here and download it now
November 30th, 2008 5:00am

JBDKZ wrote: Thanks, but the problem I am having is a VBScript problem and not with PowerShell. -j JBDKZ, Please refer to the following documentation http://msdn.microsoft.com/en-us/library/ms696472(VS.85).aspx. That method is only available for Exchange 2000 and 2003 mailbox creation. If you want to do this on Exchange 2007 you will need to use powershell. If you really want to run a vbscript then you can use ActiveXPosh from Sapien to invoke powershell and then you can run the enable-mailbox cmdlet. If you need an example I can provide one.
November 30th, 2008 7:15am

Thanks for the feedback! I will try the Powershell route.
Free Windows Admin Tool Kit Click here and download it now
November 30th, 2008 7:23pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics